//
//  AddPersonViewController.m
//  AnnCar_user
//
//  Created by LiBenCan on 17/10/25.
//  Copyright © 2017年 LiBenCan. All rights reserved.
//

#import "AddPersonViewController.h"
#import "ChangeCell.h"
#import "ChooseTextView.h"
@interface AddPersonViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong)UITableView *tableV;
@property (nonatomic,strong)NSArray *placeHodelArr;//输入框提示Arr
@property (nonatomic,strong)NSArray *titleArr;//输入TitleArr
@property (nonatomic,strong)CanLab *saveBtn;//保存按钮
@property (nonatomic,strong)UIView *footView;//区尾

@end

@implementation AddPersonViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initTitleWithTitle:@"添加联系人"];
    [self initLeftBarButtonWithImage:@"back"];
    [self.view addSubview:self.tableV];
}

-(NSArray *)titleArr//初始化数组
{
    if (!_titleArr) {
        _titleArr = @[@"姓名",@"手机号码"];
    }
    return _titleArr;
}
//创建TableView
-(UITableView *)tableV
{
    if (!_tableV) {
        _tableV = [[UITableView alloc] initWithFrame:CGRectMake(0,0, SCREENW, SCREENH-64-49) style:UITableViewStyleGrouped];
        _tableV.backgroundColor = backColor;
        _tableV.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableV.showsVerticalScrollIndicator = NO;
        _tableV.rowHeight = 50*screenW_6;
        _tableV.delegate = self;
        _tableV.dataSource = self;
    }
    return _tableV;
}

#pragma Mark TableViewDelegate
//行
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.titleArr.count;
}
//区头高度
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.00001;
}
//区尾高度
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 80*screenW_6;
}
//加载Cell
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    ChangeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ChangeCell"];
    if (cell == nil) {
        cell = [[ChangeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ChangeCell"];
    }
    [cell loadCellInputStr:@"" PlaceHodelStr:indexPath.row == 0?@"请输入姓名":@"请输入手机号码" Title:self.titleArr[indexPath.row]];
    return cell;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    if (!_footView) {//保存
        _footView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREENW, 80*screenW_6)];
        _footView.backgroundColor = backColor;
        _saveBtn = [[CanLab alloc]initWithFrame:CGRectMake(10*screenW_6,30*screenW_6,SCREENW-20*screenW_6 ,44*screenW_6) textAligment:1 font:16*screenW_6 textColor:@"#ffffff" text:@"保存"];
        _saveBtn.backgroundColor = [UIColor colorWithHexString:@"#2cb4f1"];
        [_saveBtn.layer setCornerRadius:5*screenW_6];
        _saveBtn.layer.masksToBounds = YES;
        [_footView addSubview:_saveBtn];
        _saveBtn.block = ^(CanLab *lab)//保存点击事件
        {
            
        };
    }
    return _footView;
}

@end

